<template>
	<div class="collection">
		<div class="s">
			<div class="head">
				<span>我的收藏</span>
				<div class="box"></div>
				<button class="btn1" @click="go">BACK</button>
				<div class="btn2">
					<Icon type="md-search" size="19"/>
				</div>
			</div>
		</div>
		<div class="z">
			<div>
				<Dropdown trigger="click" class="el">
					<Button type="primary" v-model="types" @click="type">
						全部类别
						<Icon type="ios-arrow-down"></Icon>
					</Button>
					<DropdownMenu slot="list">
						<DropdownItem v-model="types">
							<button @click="type1">快捷简餐</button>
						</DropdownItem>
						<DropdownItem v-model="types">
							<button @click="type2">高档餐厅</button>
						</DropdownItem>
					</DropdownMenu>
				</Dropdown>
				<Dropdown class="el" trigger="click">
					<Button type="primary" v-model="address" @click="addres">
						全部地区
						<Icon type="ios-arrow-down"></Icon>
					</Button>
					<DropdownMenu slot="list">
						<DropdownItem v-model="address">
							<button @click="addres1">上西街商区</button>
						</DropdownItem>
						<DropdownItem v-model="address">
							<button @click="addres2">下东街商区</button>
						</DropdownItem>
					</DropdownMenu>
				</Dropdown>
				<Dropdown class="el" trigger="click">
					<Button type="primary" v-model="times" @click="time">
						按时间
						<Icon type="ios-arrow-down"></Icon>
					</Button>
					<DropdownMenu slot="list">
						<DropdownItem v-model="times">
							<button @click="time1">新开店铺</button>
						</DropdownItem>
						<DropdownItem v-model="times">
							<button @click="time2">经典老铺</button>
						</DropdownItem>
					</DropdownMenu>
				</Dropdown>
			</div>
			<div class="search">
				<Input v-model="search">
					<Button slot="append">
						<Icon type="ios-search" size="20"/>
					</Button>
				</Input>
			</div>
		</div>
		<div class="li">
			<div class="xiang" v-for="we in searchList">
				<div class="left">
					<img src="" alt="">
				</div>
				<div class="right">
					<div class="top">店铺：{{we.name}}</div>
					<div class="bood">地址：{{we.address}}
						<br>
						餐厅类型：{{we.type}}
					</div>
					<div class="foot">
						<button :style="wei"></button>
						<button :style="xinl"></button>
					</div>
				</div>
			</div>

		</div>
	</div>
</template>

<script>
	import axios from 'axios'
	export default {
		name: "Discount",
		data() {
			return {
				btn: "background-image: url('" + require("../../assets/3m.png") + "')",
				bat: "background-image: url('" + require("../../assets/0m.png") + "')",
				wei: "background-image: url('" + require("../../assets/wei.png") + "')",
				xinl: "background-image: url('" + require("../../assets/xinl.png") + "')",
				back: '',
				sor: [],
				list: '',
				search: '',
				types: '',
				address: '',
				times: '',
			}
		},
		async mounted() {
			var users = JSON.parse(localStorage.users)
			let so = await this.$axios.post('/reception/Assembly/collection', {id: users.id}).then(r => r.data);
			this.sor=so.collection
			console.log(this.sor)
			// if(!so.state){
			//
			// }

		},
		computed: {
			searchList() {
				if (this.types != "") {
					var l = this.sor.filter(b => b.type.includes(this.types))
					return l
				}
				if (this.address != "") {
					var g = this.sor.filter(b => b.address.includes(this.address))
					return g
				}
				if (this.times != "") {
					var g = this.sor.filter(b => b.times.includes(this.times))
					return g
				}
				if (this.search != null) {
					var m = this.sor.filter(b => b.name.includes(this.search))
					return m
				}


			},
		},
		methods: {
			type1() {
				this.types = '快捷简餐'
			},
			addres() {
				this.address = ''
			},
			addres1() {
				this.address = '上西街商区'
			},
			addres2() {
				this.address = '下东街商区'
			},
			type2() {
				this.types = '高档餐厅'
			},
			type() {
				this.types = ''
			},
			time() {
				this.types = ''
			},
			time1() {
				this.types = '新开店铺'
			},
			time2() {
				this.types = '经典老铺'
			},
			go() {
				return this.$router.push('/users/index')
			}
		}
	}
</script>
<style lang="less">
	.collection {
		max-width: 1024px;
		max-height: 1366px;
		margin: auto;

		.s {
			width: 100%;
			background-color: white;

			.headrs {
				width: 100%;
				height: 111px;
				background-repeat: no-repeat;
				background-size: 230px;
				background-position: 70%;
			}
		}

		.ivu-select-dropdown {
			background-color: #FE7676;
		}

		.el {
			margin-left: 5%;
			width: 27%;
			text-align: center;

			button {
				border: 0px;
				color: white;
				background-color: rgba(0, 0, 0, 0);
			}
		}

		.ivu-dropdown-rel {
			margin-top: 10px;
			background-color: #FE7676;
			border-radius: 8px;
		}

		.ivu-btn-primary {
			height: 33px;
			background-color: #FE7676;
			border: #FE7676;
		}

		.ivu-input-group-append {
			border: 0px;
		}

		.ivu-input {
			height: 25px;
		}

		.ivu-avatar {
			height: 44px;
			width: 50px;
		}

		.ivu-list-item-meta-avatar {
			margin-left: 16px;
		}

		.ivu-list-item-action > li:after {
			content: none;
		}

		.ivu-list-item-action {
			position: absolute;
			right: 0;
			bottom: 0;
		}

		.li {
			width: 100%;
			height: 532px;
			background-color: #B0C1D3;
			overflow: auto;

			.xiang {
				height: 115px;
				width: 100%;
				position: relative;

				.left {
					position: absolute;
					left: 2%;
					top: 8%;
					width: 30%;
					height: 92%;
					background-color: white;
					padding: 2%;

					img {
						width: 100%;
						height: 100%;
					}
				}

				.right {
					position: absolute;
					right: 2%;
					top: 8%;
					width: 64%;
					height: 92%;
					background-color: white;
					line-height: 1;
					border: 0px;
					padding: 2%;
					text-align: center;
					.top {
						height: 25%;
						line-height: 1;
						font-weight: bold;
					}

					.bood {
						height: 55%;
						line-height: 1;
					}

					.foot {
						height: 20%;
						text-align: right;

						button {
							height: 19px;
							width: 19px;
							background-color: rgba(0, 0, 0, 0);
							border: 0;
							text-align: center;
							background-repeat: no-repeat;
							background-size: 19px;
							margin-left: 10px;
						}
					}

					.wei {
						width: 25px;
						height: 25px;
						background-repeat: no-repeat;
						background-size: 25px;

					}

					.wi {
						width: 100%;
						height: 100%;
					}

					.mag {
						position: absolute;
						bottom: 0;
					}
				}
			}
		}

		.ivu-list-items {
			min-height: 100px
		}

		.ivu-list-item {
			padding: 0;
			border: 0px;

			img {
				height: 44px;
				width: 44px;
			}
		}

		.z {
			width: 100%;
			height: 100px;

			.search {
				margin: 10px 4%;
				width: 92%;
				height: 30px;
				background-color: #FA4242;
				padding: 1px 2%;

				input {
					border-radius: 0px;
				}

				button {
					background-color: #FA4242;
					border-radius: 0px;
					color: white;
					height: 25px;
					padding-top: 0;
				}
			}

		}

		.z > .head {
			padding: 0;
		}

		.head {
			height: 35px;
			color: white;
			width: 100%;
			background: #9BB1C8;
			font-size: 22px;
			text-align: center;
			padding-right: 10px;
			line-height: 1.5;
			position: relative;
		}

		.head > .btn2 {
			height: 25px;
			width: 25px;
			float: right;
			margin-top: 5px;
			text-align: center;
			padding-top: 3px;
			line-height: 0px;
			background-color: white;
			color: #9BB1C8;
			border-radius: 5px;
		}

		.box {
			width: 0;
			height: 0;
			margin-top: 7px;
			float: left;
			border-top: 11px solid transparent;
			border-bottom: 11px solid transparent;
			border-left: 11px solid transparent;
			border-right: 11px solid white;
			/*background-color:#FEFE00 ;*/
		}

		.clear {
			clear: both;
		}

		.btn1 {
			background: white;
			font-size: 10px;
			margin-top: 7px;
			margin-left: -1px;
			color: #9BB1C8;
			height: 22px;
			padding: 0px 5px;
			border: 1px aliceblue solid;
			border-radius: 10%;
			cursor: pointer;
			float: left;
		}
	}

</style>